<?php
declare (strict_types = 1);

namespace app\validate\common\user;

use app\model\communal\UserExpertFollowModel;
use think\Validate;

class ExpertFollowValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => ['require', 'number', 'gt:0'],
        'user_id' => ['require', 'number', 'gt:0'],
        'expert_id' => ['require', 'number', 'gt:0'],

        'page' => ['number', 'gt:0'],
        'page_size' => ['number', 'gt:0'],
    ];

    protected $field = [
        'id' => '专家',
        'user_id' => '用户',
        'expert_id' => '专家',

        'page' => '当前页数',
        'page_size' => '每页条数',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 场景
     * @var array
     */
    protected $scene = [
        'index' => ['page', 'page_size'],
    ];

    /**
     * scene save owner
     *
     * @return $this
     */
    public function sceneSave()
    {
        return $this->only(UserExpertFollowModel::$saveColumn);
    }

    /**
     * scene update
     *
     * @return $this
     */
    public function sceneUpdate()
    {
        return $this->only(UserExpertFollowModel::$updateColumn);
    }
}
